package com.hefei.hight;

import java.nio.charset.StandardCharsets;

/**
 * @author caizhengjun
 * @date 2020/9/4 8:35 下午
 */
public class Test {
    public static void main(String[] args) throws Exception {
        String str = "中";
        System.out.println(str.getBytes("ISO8859-1").length);

        System.out.println(str.getBytes("GBK").length);

        System.out.println(str.getBytes("UTF-8").length);

        System.out.println(new String(str.getBytes("ISO8859-1"), "ISO8859-1"));

        System.out.println(new String(str.getBytes("GBK"), "GBK"));

        System.out.println(new String(str.getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));

    }
}
